<template>
    <div>
    <h1>用户</h1>
    <button @click="logout">退出</button>
    <button @click="login">登录</button>
    <button @click="getuser">用户信息</button>
    </div>
</template>
<style scoped>
  button{
    width: 100px;
    height: 50px;
    line-height: 50px;
    text-align: center;
    border-radius: 10px;
    outline: 0;
  }
  button::after{
    display: none;
  }
</style>
<script>
import axios from '@/common/api'
export default {
  data () {
    return {
    }
  },
  mounted () {
    // this.logout = logout
    // // debugger
    // this.login()
    // // this.changelange()
    // this.getuser()
  },
  methods: {
    changelange () {
      axios.request({
        url: '/change/language',
        method: 'GET',
        headers: {
          'Content-Type': 'application/x-www-form-urlencoded'
        },
        data: {
          'language': 'zh-CN'
        }
      })
        .then(function (response) {
          console.log(response)
        })
        .catch(function (error) {
          console.log(error)
        })
    },
    login () {
      // let self = this
      axios.request({
        url: '/member/login',
        method: 'POST',
        headers: {
          'Content-Type': 'application/x-www-form-urlencoded'
        },
        params: {
          'userName': 'hll789',
          'password': '1234567'
        }
      })
        .then(function (response) {
        //   self.$router.push('/')
        })
        .catch(function (error) {
          console.log(error)
        })
    },
    getuser () {
      axios.request({
        url: '/member/info',
        method: 'GET'
      })
        .then(function (response) {
          console.log(response)
        })
        .catch(function (error) {
          console.log(error)
        })
    },
    logout () {
      axios.request({
        url: '/member/logout',
        method: 'GET'
      })
        .then(function (response) {
          console.log(response)
        })
        .catch(function (error) {
          console.log(error)
        })
    }

  }
}
</script>
